#include <string.h>
#include <stdio.h>

void point_strlen(char * src)
{
    printf("src length = %ld\n", strlen(src));
}

int sizeof_strlen()
{
    char *mesg = "Don't be a fool!";
    char *copy;

    copy = mesg;

    printf("%s\n", copy);			// Don't be a fool!
    printf("mesg = %s : &mesg = %p : value = %p\n", mesg, &mesg, mesg); // mesg = Don't be a fool! : &mesg = 0x7ffd7cd2ba20 : value = 0x4008ca
    printf("copy = %s : &copy = %p : value = %p\n", copy, &copy, copy);	// copy = Don't be a fool! : &copy = 0x7ffd7cd2ba28 : value = 0x4008ca
    printf("sizeof(mesg) = %ld : strlen(mesg) : %ld\n", sizeof(mesg), strlen(mesg));	// sizeof(mesg) = 8 : strlen(mesg) : 16

    return 0;
}


int main()
{
	char *haystack = "aaa|0bbb||ccc||eee";
	char str[] = {0x31, 0x31, 0x00, 0x33};
	unsigned char monitor3[] = {0x55, 0xaa, 0xaa, 0x01, 0x33, 0x4d, 0x61};
	char num = '3';
	int result;

	printf( "%ld\n ", strlen(haystack));	// 18
	printf( "%ld\n ", strlen(str));			// 2
    printf( "%ld\n ", strlen(monitor3));	// 7

	printf( "%ld\n ", sizeof(haystack));	// 8
	printf( "%ld\n ", sizeof(str));			// 4
    printf( "%ld\n ", sizeof(monitor3));	// 7
	
	printf( "%x\n ", monitor3[7-2]);		// 0x4d

	printf("%c, %d, 0x%x\n", num, num, num);	// 3, 51, 0x33

	result = num - '0';			// 51 - 48 = 3
	printf("%d\n", result);		// 3

    point_strlen(haystack);		// 18
	point_strlen(str);			// 2

    sizeof_strlen();

	return 0;
}
